var express = require('express')
var router = express.Router()

var Clients = require('../models/clients')

router.post('/leaveMessage', function (req, res, next) {
    var clientName = req.body.name
    var clientTel = req.body.tel
    var clientEmail = req.body.email
    var clientContent = req.body.content
    var cilentDate = req.body.date
    Clients.create({
        clientName: clientName,
        clientTel: clientTel,
        clientEmail: clientEmail,
        clientContent: clientContent,
        cilentDate: cilentDate
    }, function (err, doc) {
        if (err) {
            res.json({
                status: 1,
                msg: err.message,
                result: ''
            })
        } else {
            res.json({
                status: 0,
                msg: '',
                result: '感谢你的建议'
            })
        }
    })
})
module.exports = router;